<template>
	<view class="preview">
		<swiper circular>
			<swiper-item v-for="item in 4">
				<image @click="disappear" src="../../common/img/1.png" mode="aspectFill"></image>
			</swiper-item>
		</swiper>
		
		<view class="mask" v-if="maskDisappear">
			<view class="goback" :style="{top:getStatusBarHeight()+'px'}" @click="back">
				
				<uni-icons type="back" color="#fff" size="20"></uni-icons>
				
			</view>
			
			<view class="count">1 / 4</view>
			
			
			<view class="time">
				<uni-dateformat :date="new Date()" format="hh:mm"></uni-dateformat>
			</view>
			<view class="date">
				<uni-dateformat :date="new Date()" format="MM月dd日"></uni-dateformat>
			</view>
			<view class="footer">
				<view class="box" @click="clickinfoPopup">
					<uni-icons type="info" size="23"></uni-icons>
					<view class="text">
						信息
					</view>
				</view>
				
				<view class="box" @click="clickScore">
					<uni-icons type="info" size="23"></uni-icons>
					<view class="text">4分</view>
				</view>
				
				<view class="box">
					<uni-icons type="info" size="23"></uni-icons>
					<view class="text">下载</view>
				</view>
				
			</view>
		</view>
		
		<uni-popup ref="infoPopup" type="bottom">
			
			<view class="infoText">
				
				<view class="infoTop">
					<view></view>
					<view class="title">关于壁纸</view>
					
					<view class="back" @click="clickBack">
						<uni-icons type="closeempty" size="18" color="#999">
							
						</uni-icons>
					</view>
				</view>
				<scroll-view scroll-y>
					<view class="content">
						<view class="row">
							<view class="label">壁纸ID：</view>
							<text selectable class="id">8888888888</text>
						</view>
						
						<view class="row">
							<view class="label">发布者：</view>
							<text selectable class="id">8888888888</text>
						</view>
						
						<view class="row">
							<view class="label">分类：</view>
							<text class="id list">8888888888</text>
						</view>
						
						<view class="row">
							<view class="label">评分：</view>
							<text selectable class="id">
								<uni-rate readonly touchable value="5" />
							</text>
						</view>
						
						<view class="row">
							<text class="label">标签：</text>
							<view class="id tabs">
								<view class="tab" v-for="item in 3">标签</view>
							</view>
						</view>
						
						<view class="copyright">
							声明：均为网络图片1111111111111111111111111111111111
						</view>
						
						
				
						
					</view>
				</scroll-view>
			</view>
			<!-- 底部弹出 -->
		</uni-popup>
		
		
		<!-- 中心弹出 -->
		<uni-popup ref="scorePopup" :is-mask-click="false">
			<view class="scorePopup">
				<view class="infoTop">
					<view></view>
					<view class="title">评分</view>
					
					<view class="back" @click="clickSlose">
						<uni-icons type="closeempty" size="18" color="#999">
							
						</uni-icons>
					</view>
				</view>
				<!-- 评分内容 -->
				<view class="content">
					<uni-rate v-model="user" allowHalf/>
					<text class="text">{{user}}分</text>
				</view>
				
				<view class="footer">
					<button @click="clickFooter" :disabled="!user" type="default" size="mini" plain>确认评分</button>
				</view>
			</view>
		</uni-popup>
		
	</view>
</template>

<script setup>
import { ref } from 'vue';

import {getStatusBarHeight} from '@/utils/system.js'

	const maskDisappear=ref(true)
	//状态层
	const disappear=()=>{
		maskDisappear.value=!maskDisappear.value
	}
	const infoPopup=ref(null);
	//弹窗层 打开
	const clickinfoPopup=()=>{
		infoPopup.value.open()
	}
	//弹窗 关闭
	const clickBack=()=>{
		infoPopup.value.close()
	}
	//评分弹出
	const scorePopup=ref(null);
	const user=ref(0);
	const clickScore=()=>{
		scorePopup.value.open();
	}
	//关闭弹出评分
	const clickSlose=()=>{
		scorePopup.value.close();
	}
	//评分逻辑
	const clickFooter=()=>{
		console.log("ok的")
	}
	
	
	//返回上一页
	const back=()=>{
		uni.navigateBack()
	}
	
</script>

<style lang="scss" scoped>
.preview{
	
	
	
	width: 100%;
	height: 100vh;
	position: relative;
	swiper{
		width: 100%;
		height: 100%;
		image{
			width: 100%;
			height: 100%;
		}
		
	}
	.mask{
		&>view{
			position: absolute;
			left: 0;
			margin: auto;
			right: 0;
			color: #fff;
			width: fit-content;//有多少内容变多大
		}
		.goback{
			width: 38px;
			height: 38px;
			background: rgba(0, 0,0,0.5);
			left: 30rpx;
			margin-left: 0;
			border-radius: 100px;
			top: 0;
			backdrop-filter: blur(10rpx);
			border: 1rpx solid rgba(255, 255,255,0.3);
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.count{
			top: 10vh;
			background: rgba(0, 0,0,0.4);
			font-size: 25rpx;
			border-radius: 40rpx;
			padding: 8rpx 25rpx;
			backdrop-filter: blur(10rpx);
		}
		.time{
			font-size: 135rpx;
			top: calc(10vh + 80rpx);//计算属性
			font-weight: 90;
			line-height: 1em;
			text-shadow: 0 4rpx rgba(0, 0,0,0.3);
		}
		.date{
			font-size: 30rpx;
			top: calc(10vh + 220rpx);
			text-shadow: 0 2rpx rgba(0, 0,0,0.3);
		}
		.footer{
			background: rgba(255, 255,255,0.8);
			bottom: 10vh;
			width: 65vw;
			height: 120rpx;
			border-radius: 120rpx;
			color: #000;
			display: flex;
			justify-content: space-around;
			align-items: center;
			box-shadow: 0 2rpx 0 rgba(0, 0,0,0.1);
			backdrop-filter:blur(20rpx);
			.box{
				display: flex;
				flex-direction: column;
				align-tracks: center;
				justify-content: center;
				padding: 2rpx 12rpx;
				.text{
					font-size: 28rpx;
					color: #676767;
				}
			}
		}
	}

.infoTop{
			display: flex;
			justify-content: space-between;
			align-items: center;
			.title{
				color: #676767;
				font-size: 26rpx;
				
			}
			.back{
				padding: 8rpx;
			}
		}
		
	.infoText{
		background: #fff;
		padding: 30rpx;
		border-radius: 30rpx 30rpx 0 0;
		 overflow: hidden;
		
		scroll-view{
			max-height: 60vh;
			.content{
				.row{
					display: flex;
					padding: 16rpx 0;
					font-size: 30rpx;
					line-height: 1.5em;
					.label{
						color: #a7a7a7a7;
						width: 140rpx;
						text-align: right;
						font-size: 25rpx;
					}
					.id{
						flex: 1;
						width: 0;
					}
					.list{
						color: #28B389;
					}
					.tabs{
						display: flex;
						flex-wrap: wrap;
						.tab{
							border: 1px solid #28B389;
							color: #28B389;
							font-size: 20rpx;
							padding: 10rpx 30rpx;
							border-radius: 40rpx;
							line-height: 1em;
							margin: 0 10rpx 10rpx 0;
						}
					}
					
				}
				.copyright{
					font-size: 28rpx;
					padding: 20rpx;
					background: #f6f6f6;
					border-radius: 1rpx;
					color: #666;
					margin: 20rpx 0;
					line-height: 1.2em;
				}
			}
		}
	}

	.scorePopup{
		background: #fff;
		padding: 30rpx;
		width: 70vw;
		border-radius: 30rpx;
		.content{
			padding: 30rpx 0;
			display: flex;
			justify-content: center;
			align-items: center;
			.text{
				color: #ffca3e;
				padding-left: 10rpx;
				width: 80rpx;
				line-height: 1em;
				text-align: right;
			}
		}
		.footer{
			padding:10rpx 0;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}


}

</style>
